package com.zeng.nicecore.bean;

import com.baomidou.mybatisplus.annotation.*;
import lombok.*;

import javax.persistence.*;
import javax.persistence.Version;
import java.util.Date;
@Data
@NoArgsConstructor
@AllArgsConstructor
@MappedSuperclass
public class CommonBean {

    @Version
    @com.baomidou.mybatisplus.annotation.Version
    @TableField(fill = FieldFill.INSERT_UPDATE, update="%s+1")
    protected Integer version;

    @TableLogic
    @Column(length = 1)
    @TableField(fill = FieldFill.INSERT)
    protected Short valid;

    @TableId(value = "code", type = IdType.UUID)
    @Column(length = 32)
    protected String code;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @TableId(value="id",type= IdType.AUTO)
    protected Integer id;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    protected Date updateDate;

    @TableField(fill = FieldFill.INSERT)
    protected Date insertDate;
}
